home *** CD-ROM | disk | FTP | other *** search
-
-
-
- TTTTAAAASSSSKKKKBBBBLLLLOOOOCCCCKKKK((((3333PPPP)))) TTTTAAAASSSSKKKKBBBBLLLLOOOOCCCCKKKK((((3333PPPP))))
-
-
-
- NNNNAAAAMMMMEEEE
- taskblock, taskunblock, tasksetblockcnt - routines to block/unblock tasks
-
- CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ttttaaaasssskkkk....hhhh>>>>
-
- iiiinnnntttt ttttaaaasssskkkkbbbblllloooocccckkkk ((((ttttiiiidddd____tttt ttttiiiidddd))));;;;
-
- iiiinnnntttt ttttaaaasssskkkkuuuunnnnbbbblllloooocccckkkk ((((ttttiiiidddd____tttt ttttiiiidddd))));;;;
-
- iiiinnnntttt ttttaaaasssskkkksssseeeettttbbbblllloooocccckkkkccccnnnntttt ((((ttttiiiidddd____tttt ttttiiiidddd,,,, iiiinnnntttt ccccoooouuuunnnntttt))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- These routines provide a complete set of blocking/unblocking capabilities
- for tasks. Blocking is implemented via a counting semaphore in the
- system. Each call to _t_a_s_k_b_l_o_c_k decrements the count and, if it goes
- negative, the task is suspended. When _t_a_s_k_u_n_b_l_o_c_k is called, the count
- is incremented, and if it goes positive (or zero), the task is re-
- started. This provides both a simple, race free synchronization ability
- between two tasks, as well as a much more powerful capability to
- synchronize multiple tasks.
-
- In order to guarantee a known starting place the _t_a_s_k_s_e_t_b_l_o_c_k_c_n_t function
- may be called which will force the semaphore count to the value given by
- _c_o_u_n_t. New tasks have their semaphore zeroed. Normally, _c_o_u_n_t should be
- set to 0. If the resulting block count is greater than or equal to zero
- and the task is currently blocked, it will be unblocked. If the
- resulting block count is less than zero, the task will be blocked. Using
- this, a simple rendezvous mechanism can be set up. If one task wanted to
- wait for _n other tasks to complete, it could set its block count to -_n.
- This would immediately force the task to block. Then as each task
- finishes it unblocks the waiting task. When the _n'_t_h task finishes the
- waiting task will be woken.
-
- A task may block another task provided that standard UNIX permissions are
- satisfied.
-
- These routines will fail and no operation will be performed if one or
- more of the following are true:
-
- [EINVAL]
- The _t_i_d specified is not a valid task id.
-
- [EPERM]
- The caller is not operating on itself, its effective user ID is not
- super-user, and its real or effective user ID does not match the
- real or effective user ID of the to be acted on task.
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- TTTTAAAASSSSKKKKBBBBLLLLOOOOCCCCKKKK((((3333PPPP)))) TTTTAAAASSSSKKKKBBBBLLLLOOOOCCCCKKKK((((3333PPPP))))
-
-
-
- SEE ALSO
- blockproc(2), taskdestroy(3P), taskctl(3P), taskcreate(3P).
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Upon successful completion, 0 is returned. Otherwise, a value of -1 is
- returned to the calling task, and _e_r_r_n_o is set to indicate the error.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-